﻿using AutoMapper;
using B.S.DataBase.SuY.Wirt.Api.AutoList.Command;
using B.S.DataBase.SuY.Wirt.Api.Dto;
using B.S.DataBase.SuYuan.Domain.Model;
using B.S.DataBase.SuYuan.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.DataBase.SuY.Wirt.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ComController : ControllerBase
    {

        private readonly IMediator _mediator;

        public ComController(IMediator mediator)
        {
            _mediator = mediator;
        }

        [HttpGet]
        public Task<ApiReslit<List<Commodity>>> ShowCommd()
        {
            ShowCommodityCommand request = new ShowCommodityCommand();
            return _mediator.Send(request);

        }

        [HttpGet]
        public Task<ApiReslit<ApiPaging<GoodDto>>> ShowGoods(int PageIndex, int PageSize)
        {
            showGoodCommand  command = new showGoodCommand();
            command.PageSize = PageSize; 
            command.PageIndex = PageIndex;
            return _mediator.Send(command);

        }
     
    }
}
